#ifndef __WIZ_THREAD_RUNNABLE_HPP__SHANHAOBO_19800429__
#define __WIZ_THREAD_RUNNABLE_HPP__SHANHAOBO_19800429__

#include "../../Base/WizBase.hpp"
#include "../WizAtomicCount.hpp"

namespace Wiz
{
    namespace Thread
    {
        //////////////////////////////////////////////////////////////////////////
        namespace TLS
        {
            namespace DataNode
            {
                struct Type;
            } /// end of namespace DataNode
        } /// end of namespace TLS

        //////////////////////////////////////////////////////////////////////////
        namespace Runnable
        {
            class WIZ_EXPORT Type
            {
            public:
                virtual ~Type(){}
                virtual ::Wiz::Void::Type Run() = 0;
            public:
                ::Wiz::Bool::Type                       m_AutoRM;
                ::Wiz::Thread::TLS::DataNode::Type*     m_TLSDataNodePtr;
            };
            WIZ_DECLARE(::Wiz::Thread::Runnable::Type);

            /// 
            namespace Extend
            {
                class WIZ_EXPORT Type : public ::Wiz::Thread::Runnable::Type
                {
                private:
                    virtual ::Wiz::Void::Type Run();
                    ::Wiz::AtomicCount::Ptr     m_Suspend;
                public:
                    Type();
                public:
                    ::Wiz::Void::Type Suspend();
                    ::Wiz::Void::Type Unsuspend();
                    virtual ::Wiz::Bool::Type Enter() = 0;
                    virtual ::Wiz::Void::Type Running() = 0;
                    virtual ::Wiz::Bool::Type Exit() = 0;
                };
            } /// end of namespace Extend
        } /// end of namespace Runnable
        //////////////////////////////////////////////////////////////////////////
    } /// end of namespace Thread
} /// end of namespace Wiz

#endif /*__WIZ_THREAD_RUNNABLE_HPP__SHANHAOBO_19800429__*/
